using System;

namespace LogikBug.ModularMvc.Attributes
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	public class RegisterModuleAttribute : Attribute
	{
		public RegisterModuleAttribute(Type moduleType)
		{
			if (moduleType.Inherits<IModule>())
			{
				throw new InvalidOperationException(
					string.Format("Type '{0}' must implement from LogikBug.ModularMvc.IModule", moduleType.Name)
				);
			}

			ModuleType = moduleType;
		}

		public Type ModuleType { get; set; }
	}
}